# 7.3 根据正方形的边长，计算面积。

# 无参数，无返回值
def square1():
    print(5*5)

# 有参数，无返回值
def square2(r):
    print(r**2)

# 无参数，有返回值
def square3():
    return 5**2

# 有参数，有返回值
def square4(r):
    S = r**2
    return S

square1()
square2(5)
print(square3())
print(square4(5))


def compluter(type):
    if type=="add":
        return lambda n1,n2:n1+n2
    elif type=="jian":
        return lambda n1,n2:n1-n2
    else:
        return lambda n1,n2:n1*n2

fun=compluter("add")
print(fun(1,2))

fun=compluter("jian")
print(fun(8,3))

fun=compluter("sqr")
print(fun(6,3))